package com.sc.design.component;

import java.util.ArrayList;

/**
 * @author sc
 * Created on  2017/12/6
 */
public class Client {

    public static String getTreeInfo(Branch root){
        ArrayList<Crop> list = root.getSubInfo();
        String info = "";
        for(Crop c:list){
            if(c instanceof Leaf){
                info = info +c.getInfo();
            }else {
                info = info+c.getInfo()+getTreeInfo((Branch) c);
            }
        }
        return info;
    }

    public static void main(String[] args) {
        Branch boss = composite();
        System.out.println(boss.getInfo());
        System.out.println(getTreeInfo(boss));
    }

    private static Branch composite() {
        //生成人员
        return  null;
    }
}
